home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0122_smooth text scroll.pas < prev    next >
Pascal/Delphi Source File  |  1994-08-24  |  2KB  |  89 lines

  1. {
  2. Here's a demo for a REAL smooth textscroll. Reset lines to something usefull,
  3. cut the sideborders, place some readable text, and your scroller is ready! ;-)
  4.  
  5. }
  6. program smoothtextscroll;
  7. { by Bas van Gaalen and Sven van Heel, Holland, PD }
  8. uses crt;
  9. const vidseg:word=$b800; lines=23;
  10. var ofs:byte;
  11.  
  12. procedure vertrace; assembler; asm
  13.   mov dx,03dah; @vert1: in al,dx; test al,8; jnz @vert1
  14.   @vert2: in al,dx; test al,8; jz @vert2; end;
  15.  
  16. procedure setaddress(ad:word); assembler; asm
  17.   mov dx,3d4h; mov al,0ch; mov ah,[byte(ad)+1]; out dx,ax
  18.   mov al,0dh; mov ah,[byte(ad)]; out dx,ax; end;
  19.  
  20. procedure setsmooth(smt:byte); assembler; asm
  21.   mov dx,03c0h; mov al,13h+32; out dx,al; inc dx; in al,dx
  22.   and al,11110000b; mov ah,smt; or al,ah; dec dx; out dx,al; end;
  23.  
  24. procedure setup(ad:word); assembler;
  25. asm
  26.   mov dx,3d4h
  27.   mov al,18h
  28.   mov ah,[byte(ad)]
  29.   out dx,ax
  30.   mov al,7
  31.   out dx,al
  32.   inc dx
  33.   in al,dx
  34.   dec dx
  35.   mov ah,[byte(ad)+1]
  36.   and ah,00000001b
  37.   shl ah,4
  38.   and al,11101111b
  39.   or al,ah
  40.   mov ah,al
  41.   mov al,7
  42.   out dx,ax
  43.  
  44.   mov al,9
  45.   out dx,al
  46.   inc dx
  47.   in al,dx
  48.   dec dx
  49.   mov ah,[byte(ad)+1]
  50.   and ah,00000010b
  51.   shl ah,5
  52.   and al,10111111b
  53.   or al,ah
  54.   mov ah,al
  55.   mov al,9
  56.   out dx,ax
  57.  
  58.   mov dx,03c0h
  59.   mov al,10h+32
  60.   out dx,al
  61.   inc dx
  62.   in al,dx
  63.   and al,11011111b
  64.   or al,00100000b
  65.   dec dx
  66.   out dx,al
  67. end;
  68.  
  69. var x,y,i:word; cx:byte;
  70. begin
  71.   setup(lines*16);
  72.   setaddress((25-lines)*80);
  73.   gotoxy(1,1);
  74.   writeln('Hey, a smooth textscroll...');
  75.   x:=0; cx:=0;
  76.   randomize;
  77.   repeat
  78.     vertrace;
  79.     setsmooth(x); ofs:=ofs mod 4;
  80.     x:=(1+x) mod 9; if x=0 then begin
  81.       for y:=0 to lines-1 do begin
  82.         move(mem[$b800:160*(25-lines+y)+4],mem[$b800:160*(25-lines+y)+2],158);
  83.         mem[$b800:(25-lines+y)*160+158]:=random(26)+32;
  84.       end;
  85.     end;
  86.   until keypressed;
  87.   textmode(lastmode);
  88. end.
  89.